package com.isoft.dao.flight;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.isoft.entity.flight.FlightView;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * 航班视图数据层
 */
@Mapper
public interface FlightViewDao extends BaseMapper<FlightView> {
    //查询所有的航班信息

    @Select("select ID,FLID,FIDE,FRLT,FRTT,VALID from TEAM04.FLIGHT_VIEW")
    List<FlightView> selectAllFlightView();


    //根据航班号查询航班信息


    @Select("select ID,FLID,FIDE,FRLT,FRTT,VALID from TEAM04.FLIGHT_VIEW where FLID=#{FLID}")
    List<FlightView> selectFlightViewByFLID(@Param("FLID") Integer FLID);

    //增加

    @Insert("INSERT INTO TEAM04.FLIGHT_VIEW(FLID,FIDE,FRLT,FRTT) VALUES(#{FLID},#{FIDE},#{FRLT},#{FRTT})")
    int insertFlightView(FlightView flightView);


    //根据id更改
    @Update("update TEAM04.FLIGHT_VIEW set FLID=#{FLID},FIDE=#{FIDE},FRLT=#{FRLT},FRTT=#{FRTT},VALID=#{VALID} where ID=#{ID}")
    int updateFlightView(FlightView flightView);


    //根据id删除航班信息
    @Delete("delete from TEAM04.FLIGHT_VIEW where ID=#{ID}")
    int deleteFlightView(Integer ID);


    //分页查询
    @Override
    List<FlightView> selectList(Wrapper<FlightView> queryWrapper);
}
